<?php
$this->breadcrumbs=array(
	Yii::t('ProductPost','Quản lý sản phẩm '.$channel->title)=>array('.'),
);

$this->menu=array(
	array('label'=>CHtml::tag('span', array(), NHtml::themeImage('images/icons/round_add_32.png')) . 
		Yii::t('backend','Thêm'), 'url'=>array('create', 'channel_id'=>$channel->id)),

	array('label'=>CHtml::tag('span', array(), NHtml::themeImage('images/icons/trash_32.png')) . 
		Yii::t('backend','Xóa'), 'url'=>'javascript:void(0)', 
		'linkOptions'=>array('class'=>'multi-submit-button','data-href'=>CHtml::normalizeUrl(array('multiDelete')))),
);

Yii::app()->clientScript->registerScript(uniqid(), "
$('.search-button').click(function(){
	$(this).toggleClass('active');
	$('.search-form').toggle();
	return false;
});
$('.multi-submit-button').click(function(){if(confirm('".Yii::t('backend','Thao tác nhiều dữ liệu?')."')) submitMultiple($(this), 'product-post-grid'); return false;}); 
");
?>

<?php 

$pageSize = Yii::t('backend','Hiển thị:');
$pageSize .= CHtml::dropDownList('perPage',Yii::app()->session->get('backendPageSize',25),Yii::app()->params['backendPageSizeOptions'],array('ajax'=>array('url'=>$this->createUrl('pageSize'),'data'=>'js:{"pageSize":this.value}','success'=>'js:function(data){$.fn.yiiGridView.update("product-post-grid");}')));
$pageSize = CHtml::tag('div', array('class'=>'page-size-holder left mrm'), $pageSize);

$this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'product-post-grid',
	// 'ajaxUpdate'=>false,
	'selectableRows'=>Yii::app()->session->get('backendPageSize',25),
	'dataProvider'=>$dataProvider,
	'filter'=>$model,
	'template'=>'{summary} {items} <div class="pager-holder">'.$pageSize . '{pager}</div>',
  	'pagerCssClass'=>'left mts',
	'columns'=>array(
		array('class'=>'CCheckBoxColumn','id'=>'multiselect'),
    	array('header'=>'#','value'=>'$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + $row+1 ','headerHtmlOptions'=>array('width'=>'5')),
		array('name'=>'channel_id','value'=>'CHtml::link($data->channel_id, array("update", "id"=>$data->id))','type'=>'raw'),
		'title',
		'code',
		'price',
		'image_link',
		'view_count',
		array('class'=>'NSortColumn','name'=>'sort'),
		array('class'=>'NTriggerColumn','name'=>'visible'),
		
		array('name'=>'id','headerHtmlOptions'=>array('width'=>'5')),
	),

)); 

?>
